
const propertyName = '$globalUtils'
const globalUtils =  {
    /**
     * 写入方法
     * @param fn 方法
     * @param fnName 对应名
     */
    pushUtil: (fn, fnName) => {
        if (!window[propertyName]) window[propertyName] = {}
        if (Object.prototype.toString.call(window[propertyName]) === '[object Object]') {
            if (fn) window[propertyName][fnName] = fn
        }
    },
    /**
     * 移除方法
     * @param fnName 方法名
     */
    removeUtil: fnName => {
        if (!window[propertyName]) return
        if (Object.prototype.toString.call(window[propertyName]) === '[object Object]') {
            delete window[propertyName][fnName]
        }
    }
}

export default globalUtils